package cn.amossun.starter.common.util;

import cn.amossun.starter.common.enums.DesensitizedType;

public class DesensitizedExecutor {

    public static String desensitized(DesensitizedType type, String origin){

        String result;

        switch (type) {
            case DEFAULT_SKIP:
                return origin;
            case CHINESE_NAME:
                result = DesensitizedUtils.chineseName(origin);
                break;
            case ID_CARD:
                result = DesensitizedUtils.idCardNum(origin);
                break;
            case PASSPORT:
                result = DesensitizedUtils.idPassport(origin);
                break;
            case FIXED_PHONE:
                result = DesensitizedUtils.fixedPhone(origin);
                break;
            case MOBILE_PHONE:
                result = DesensitizedUtils.mobilePhone(origin);
                break;
            case ADDRESS:
                result = DesensitizedUtils.address(origin);
                break;
            case EMAIL:
                result = DesensitizedUtils.email(origin);
                break;
            case BANK_CARD:
                result = DesensitizedUtils.bankCard(origin);
                break;
            case PASSWORD:
                result = DesensitizedUtils.password(origin);
                break;
            case KEY:
                result = DesensitizedUtils.key(origin);
                break;
            default:
                throw new IllegalArgumentException("Unknown sensitive type enum " + type);
        }

        return result;
    }
}
